using System.Collections.Generic;
using Sitecore.Data.Items;

namespace ColorBox4Sitecore.Helpers
{
    public class ColorboxTranslateHelper
    {
        protected const string TranslationItemPath = "/sitecore/system/Modules/Colorbox4Sitecore/Resources/ColorboxTranslations";
        protected static Dictionary<string, Item> TranslationItem = new Dictionary<string,Item>();

        public static string Translate(string key)
        {
            if(!TranslationItem.ContainsKey(Sitecore.Context.Database.Name))
                TranslationItem.Add(Sitecore.Context.Database.Name, Sitecore.Context.Database.SelectSingleItem(TranslationItemPath));

            return TranslationItem[Sitecore.Context.Database.Name][key];
        }
    }
}